import unittest


class Demo1TestCase(unittest.TestCase):
    def test1(self):
        print('test1')

    def test2(self):
        print('test2')


class Demo2TestCase(unittest.TestCase):
    def testa(self):
        print('testa')

    def testb(self):
        print('testb')


if __name__ == '__main__':
    # TODO suite 测试套件
    # TODO addTests
    # 创建suite对象
    suite = unittest.TestSuite()
    tests = [
        Demo1TestCase('test1'),
        Demo2TestCase('testb'),
        Demo1TestCase('test2')
    ]
    # for test in tests:     # suite.addTests()  源码
    #     suite.addTest(test)
    suite.addTests(tests)

    # 创建runner
    runner = unittest.TextTestRunner(verbosity=2)
    runner.run(suite)
